/*
 * Created on Fri Dec 17 16:04:56 CET 2010
 */

/* 
 * This Bundle implements a service who simulate a sensor and expose the temperature value regularly.
 */

package org.ece.meteo.capteurTemp;

import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;

public class Activator implements BundleActivator {
	
	static BundleContext BC;
	Thread c_temp1;
  
	/**
	 * Implements Activator.start(). Prints that it is starting,
	 * implements c_temp1 as CapteurTemp() thread and start it. 
	 * @param context the framework context for the bundle.
	**/
  public void start(BundleContext context) throws Exception {
	  BC = context;
	  c_temp1 = new CapteurTemp();
	  c_temp1.start(); // Start thread
	  System.out.println("> org.ece.meteo.capteurTemp started");
  }

	/**
	 * Implements Activator.stop(). Prints that it is stopping and
	 * stop the CapteurTemp() thread. 
	 * @param context the framework context for the bundle.
	**/
  public void stop(BundleContext context) throws Exception {
	   ((CapteurTemp) c_temp1).halt();	// stop thread
		System.out.println("> org.ece.meteo.capteurTemp resolved");
  }
}